from flask import Flask, request, jsonify
from basic_predict_fun import predict

app = Flask(__name__)

# @app.route("/predict", methods=["POST"])
def api_predict():
    data = request.get_json()
    text = data.get("text", "")
    task = data.get("task", "all")

    result = predict(text, task=task)
    return jsonify(result)

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=5000, debug=True)
